<?php
/**
* Copyright 2009 Waag Society <http://www.waag.org>
* This file is part of Annotrax.
*
* Annotrax is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License,
* or (at your option) any later version.
*
* Annotrax is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Annotrax.
* If not, see http://www.gnu.org/licenses/gpl.html
*/

?>
<?php
/**
 * View file for the homepage
 */
// movies are now loaded from an ini file. this is propably not such a good idea
// but using Zend_Config is a good choice still.
// @TODO a nice way would be to have a custom config adapter that uses a DB TABLE
$atConfig 	= Zend_Registry::get('atConfig');
$topMovies 	= array();
// initialize a selection of front-page movies
foreach( $atConfig->topMovies as $id ){
	$topMovies[] = new Default_Model_Movie( $id );
}
// hmhmm. first movie right.
$movie = reset( $topMovies );
?>
<div id="movieSection" class="section">
	<a href="/movie/play/<?php echo $movie->id ?>" class="floatLeft">
		<img class="floatLeft" src="/frame/image/<?php echo $movie->id ?>/<?php echo $movie->posterFrame ?>" />
	</a>
	<div id="atSideBar">
		<h1><?php echo $movie->title ?></h1>
		<strong><?php echo $movie->date ?>
		<span class="duration"><?php echo array_shift( explode( '.', $movie->getInfo()->contentDuration ) ); ?></span></strong>
		<p>
			<?php echo $movie->description ?>
		</p>
		<div class="buttonBar">
			<a href="/movie/play/<?php echo $movie->id ?>"><?php echo $this->translate("play this movie") ?></a>
			<a href="/movie/annotate/<?php echo $movie->id ?>"><?php echo $this->translate("annotate this movie") ?></a>
		</div>
	</div>
</div>
<div id="frontpage-movieList" class="section">
	<?php echo $this->MovieList( $topMovies ); ?>
</div>
